// Package transport
// Title  			user.transport.go
// Description  	DecodeGetClusterRequest传输层
// Author  alittlexincan@163.com  2024/07/22 11:36
// Update  alittlexincan@163.com  2024/07/22 11:36
package transport

import (
	"context"
	"net/http"

	"xincan.com.cn/tarot-go-framework/business/enum"
	"xincan.com.cn/tarot-go-framework/business/user/dto"
)

// DecodeCreateUserRequest
// Title DecodeCreateUserRequest
// Description 获取传输对象
// Auth      		alittlexincan@163.com         			"时间（2024/07/22 11:36）"
// Param			ctx				context.Context			"上下文对象"
// Param			r				*http.Request			"请求对象"
// Return			dto.ClusterDto							"传输对象"
// Return			error									"错误信息"
func DecodeCreateUserRequest(_ context.Context, r *http.Request) (interface{}, error) {
	return &dto.CreateUserDto{
		Name:     r.FormValue("name"),
		Password: r.FormValue("password"),
		Role:     r.FormValue("role"),
		Status:   r.FormValue("status"),
		Type:     enum.UserEnum(r.FormValue("type")),
	}, nil
}

// DecodeSearchUserListRequest
// Title DecodeSearchUserListRequest
// Description 获取传输对象
// Auth      		alittlexincan@163.com         			"时间（2024/07/22 11:36）"
// Param			ctx				context.Context			"上下文对象"
// Param			r				*http.Request			"请求对象"
// Return			dto.ClusterDto							"传输对象"
// Return			error									"错误信息"
func DecodeSearchUserListRequest(_ context.Context, r *http.Request) (interface{}, error) {
	return &dto.SearchUserListDto{
		Id: r.FormValue("id"),
	}, nil
}
